package com.only4play.productcenter.domain.agent;

/**
 * @author hinzzz www.hinzzz.cn 157957329@qq.com
 * 2024-02-27
 */

import com.only4play.codegen.processor.creator.IgnoreCreator;
import com.only4play.codegen.processor.repository.GenRepository;
import com.only4play.codegen.processor.updater.IgnoreUpdater;
import com.only4play.common.constants.ValidStatus;
import com.only4play.jpa.converter.ValidStatusConverter;
import com.only4play.jpa.support.BaseJpaAggregate;
import lombok.Data;

import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Table;


@GenRepository(pkgName = "com.only4play.productcenter.domain.agent.repository")

@Entity
@Table(name = "agent_store")
@Data
public class AgentStore extends BaseJpaAggregate {

    private Long agentId;

    private Long storeId;

    @Convert(converter = ValidStatusConverter.class)
    @IgnoreUpdater
    @IgnoreCreator
    private ValidStatus validStatus;

    public void init() {
        setValidStatus(ValidStatus.VALID);
    }

    public void valid() {
        setValidStatus(ValidStatus.VALID);
    }

    public void invalid() {
        setValidStatus(ValidStatus.INVALID);
    }
}